package com.easyCms.base.service;

import com.easyCms.base.common.CodeConst;
import com.easyCms.base.dao.BsSystemInfoDAO;
import com.easyCms.base.entity.BsSystemInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Service
public class BsSystemInfoSV {
    @Autowired
    private BsSystemInfoDAO bsSystemInfoDAO;

    public BsSystemInfo findValid() {
        List<BsSystemInfo> bsSystemInfos = bsSystemInfoDAO.findByState(CodeConst.State.STATE_VALID);
        if (!CollectionUtils.isEmpty(bsSystemInfos)) {
            return bsSystemInfos.get(0);
        }
        return null;
    }

}
